import request from '@/config/axios'

// 店铺员工 VO
export interface StaffVO {
  id: number // id
  shopId: number // 店铺id
  shopIdentityId: number // 店铺身份id
  title: string // 头衔
  name: string // 名字
  avatarImg: string // 头像
  salary: number // 薪资
  service: string // 服务
}

// 店铺员工 API
export const StaffApi = {
  // 查询店铺员工分页
  getStaffPage: async (params: any) => {
    return await request.get({ url: `/shop/staff/page`, params })
  },

  // 查询店铺员工详情
  getStaff: async (id: number) => {
    return await request.get({ url: `/shop/staff/get?id=` + id })
  },

  // 新增店铺员工
  createStaff: async (data: StaffVO) => {
    return await request.post({ url: `/shop/staff/create`, data })
  },

  // 修改店铺员工
  updateStaff: async (data: StaffVO) => {
    return await request.put({ url: `/shop/staff/update`, data })
  },

  // 删除店铺员工
  deleteStaff: async (id: number) => {
    return await request.delete({ url: `/shop/staff/delete?id=` + id })
  },

  // 导出店铺员工 Excel
  exportStaff: async (params) => {
    return await request.download({ url: `/shop/staff/export-excel`, params })
  },

// ==================== 子表（店铺员工身份） ====================

  // 获得店铺员工身份分页
  getStaffIdentityPage: async (params) => {
    return await request.get({ url: `/shop/staff/staff-identity/page`, params })
  },
  // 新增店铺员工身份
  createStaffIdentity: async (data) => {
    return await request.post({ url: `/shop/staff/staff-identity/create`, data })
  },

  // 修改店铺员工身份
  updateStaffIdentity: async (data) => {
    return await request.put({ url: `/shop/staff/staff-identity/update`, data })
  },

  // 删除店铺员工身份
  deleteStaffIdentity: async (id: number) => {
    return await request.delete({ url: `/shop/staff/staff-identity/delete?id=` + id })
  },

  // 获得店铺员工身份
  getStaffIdentity: async (id: number) => {
    return await request.get({ url: `/shop/staff/staff-identity/get?id=` + id })
  },

// ==================== 子表（店铺员工工资） ====================

  // 获得店铺员工工资分页
  getStaffSalaryPage: async (params) => {
    return await request.get({ url: `/shop/staff/staff-salary/page`, params })
  },
  // 新增店铺员工工资
  createStaffSalary: async (data) => {
    return await request.post({ url: `/shop/staff/staff-salary/create`, data })
  },

  // 修改店铺员工工资
  updateStaffSalary: async (data) => {
    return await request.put({ url: `/shop/staff/staff-salary/update`, data })
  },

  // 删除店铺员工工资
  deleteStaffSalary: async (id: number) => {
    return await request.delete({ url: `/shop/staff/staff-salary/delete?id=` + id })
  },

  // 获得店铺员工工资
  getStaffSalary: async (id: number) => {
    return await request.get({ url: `/shop/staff/staff-salary/get?id=` + id })
  }
}